package com.dt76.smallloanfrontenduser.controller.linte;

import com.dt76.smallloanfrontenduser.pojo.linte.RepaymentInfo;
import com.dt76.smallloanfrontenduser.remote.linte.RepaymentRemote;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class RepaymentController {

    private final RepaymentRemote repaymentRemote;

    public RepaymentController(RepaymentRemote repaymentRemote) {
        this.repaymentRemote = repaymentRemote;
    }

    @RequestMapping("/getAll/{userId}")
    @ResponseBody
    public List<RepaymentInfo> getAll(@PathVariable Integer userId){
        return repaymentRemote.getList(userId);
    }

    @RequestMapping("/doneRep/{repId}")
    @ResponseBody
    public Integer doneRep(@PathVariable Integer repId){
        return repaymentRemote.doneRep(repId);
    }



}
